#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e5;
typedef int LL;
LL n;
double x;
double f(LL a,LL b)
{
    return 1.0*a/(1.0*b);
}
void solve()
{
    LL l=1;LL r=n;
    double eps=0x3f3f3f3f;
    LL up=0;LL down=0;
    ///double ans = min(f(l), f(r));
    while (l + 2 < r)
    {
        LL m1 = l + (r - l) / 3;
        LL m2 = l + (r - l) / 3 * 2;

        debug(l);
        debug(m1);debug(m2);
        double f1 = f(l,m1), f2 = f(l,m2);
        if(fabs(f1-1.0*x)<eps ){
            up=l;
            down=m1;
            eps=fabs(f1-1.0*x);
        }
        else if(fabs(f1-1.0*x)==eps){
            up=min(up,l);
            down=m1;
        }
        if(fabs(f2-1.0*x)<eps){
            up=l;
            down=m2;
        }
        else if(fabs(f2-1.0*x)==eps){
            up=min(up,l);
            down=m2;
        }
        ///<=
        if ( fabs(f1-1.0*x) <= fabs(f2-1.0*x) )
            r = m2;
        else
            l = m1;
    }
  ///  for (int i = l; i <= r; ++i)
  ///      ans = min(ans, f(i));
    LL gcd=__gcd(up,down);
    cout<<up/gcd<<endl;
    cout<<down/gcd<<endl;
    ///return ans;
}

int main(void)
{
  cin.tie(0);std::ios::sync_with_stdio(false);
  cin>>n;
  cin>>x;
  solve();
return 0;
}
